/*
 * Registro.cpp
 *
 *  Created on: 29/09/2011
 *      Author: gisedaye
 */

#include "Record.h"

Record::Record(string id, string value) {
	this->id=id;
	this->value=value;
}

int Record::getDispersionNumber(int hashTableSize){

	unsigned int hash = 0;
	unsigned int strLenght=this->id.size();
	unsigned int i=0;
	for (i=0;i<strLenght;i++){
		hash += atoi(&this->id[i]);
		hash += (hash << 10);
		hash ^= (hash >> 6);

	}

	hash += (hash << 3);
	hash ^= (hash >> 11);
	hash += (hash << 15);
	return (hash%hashTableSize);


}

string Record::getId(){
	return this->id;
}
string Record::getValue(){
	return this->value;
}
void Record::setId(string id){
	this->id=id;
}
void Record::setValue(string value){
	this->value=value;
}

string Record::toString(){
	string recordString="";
	recordString+=this->id;
	recordString+='-';
	recordString+=this->value;
	return recordString;
}
Record::~Record() {
}
